package com.atguigu.my.chapter02

/**
 *
 * @description: xxx
 * @time: 2020-05-22 14:11
 * @author: baojinlong 
 **/
object FunctionTest2 {
  def main(args: Array[String]) {
    def test(code: => Unit) {
      println("start")
      code
      println("end")
    }
    test {
      println("when evaluated")
      println("bb")
    }

    def test1(code: () => Unit) {
      println("start")
      code()
      println("end")
    }
    test1 {
      () =>
        println("when evaluated")
        println("bb")
    }
  }

}
